home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 4
/
Apprentice-Release4.iso
/
Languages
/
Caml Light 0.7
/
Caml Light 0.7 source
/
src
/
tools
/
makedepend
< prev
next >
Wrap
Text File
|
1995-06-05
|
3KB
|
96 lines
# MakeDepend -- Extract dependency information from C and Caml Light sources.
# Usage : MakeDepend {-C|-Caml} {file.c|file.ml}…
Set Echo 0
If ! "{TempFolder}"
Set TempFolder "{MPW}"
End
Set temp1 "{TempFolder}"MakeDepend.temp1
Set temp2 "{TempFolder}"MakeDepend.temp2
Open -n "{temp1}" "{temp2}"
Set Exit 0
If "{1}" == "-C"
Loop
Break if {#} == 1
Shift
Clear •:∞ "{temp1}"
Echo {1} > "{temp2}"
Files "`Catenate "{temp2}"`" ∑Dev:Null
If {Status} != 0
Echo "### MakeDepend: File not found: "`Catenate "{temp2}"` >Dev:StdErr
Else
(
Loop
Compare "{temp1}" "{temp2}" >Dev:null && Break
Catenate "{temp2}" > "{temp1}"
Search -q /•[ ∂t]*#[ ∂t]*include[ ∂t]*∂"/ `Catenate "{temp1}"` >>"{temp2}"
Find • "{temp2}"
Replace -c ∞ /•[¬"∂n]*∂"([¬"∂n]*)®0∂"≈/ ®0 "{temp2}"
Files -s `Sort -unique "{temp2}"` >"{temp2}"
End
) ≥Dev:null
Find • "{temp2}"; Replace -c ∞ /•(≈)®0∂n/ "{1}.o ƒ ®0∂n" "{temp2}"
Catenate "{temp2}"
End
End
Else if "{1}" == "-Caml"
Shift
Unset Path_arg
Loop
If "{1}" == "-I"
Set Path_arg "{2} {Path_arg}"
Shift 2
Else
Break
End
End
Loop
Break if {#} == 0
Search -q /•[ ∂t]*#[ ∂t]*open[ ∂t]*∂"/ "{1}" >"{temp1}" ≥Dev:null
Find • "{temp1}"; Replace -c ∞ /•[¬"]*∂"([¬"]*)®0∂"≈∞/ "®0" "{temp1}"
(
Catenate "{1}" >"{temp2}"
Find • "{temp2}"; Clear -c ∞ /'(*'/:/'*)'/ "{temp2}"
Find • "{temp2}"
Loop
Find /[A-Za-z0-9∂'](_«0,1»[A-Za-z0-9∂']+)*[ ∂t∂n]*__/ "{temp2}"
Break if {Status}
Find Δ§ "{temp2}"
Find /[A-Za-z0-9∂'](_«0,1»[A-Za-z0-9∂']+)*/ "{temp2}"
(Catenate "{temp2}".§; Echo) >> "{temp1}"
End
) ≥Dev:null
If "{1}" =~ /(≈)®1.ml/
Set ModuleName "{®1}"
Set TargetName "{ModuleName}.zo"
If "`Exists -f -q {ModuleName}.mli`"
Echo "{TargetName} ƒ {ModuleName}.zi"
End
Else If "{1}" =~ /(≈)®1.mli/
Set ModuleName "{®1}"
Set TargetName "{ModuleName}.zi"
Else
Echo "### MakeDepend: Bogus file name : {1}" >Dev:StdErr
Set ModuleName ''
Set TargetName '#'
End
For i in `Sort -unique "{temp1}"`
Continue if "{i}" == "{ModuleName}"
For j in '' {Path_arg}
If "`Exists -f -q {j}{i}.mli`"
Echo "{TargetName} ƒ {j}{i}.zi"
Break
Else If "`Exists -f -q {j}{i}.ml`"
Echo "{TargetName} ƒ {j}{i}.zo"
Break
End
End
End
Shift
End
Else
Echo '### usage : MakeDepend {-C|-Caml} {file.c|file.ml}…' >Dev:Stderr
End
Close -n "{temp1}" "{temp2}"